package mspbots.data.tl.prod.contactscience.listener;

import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import mspbots.data.tl.entity.ResultMessageModel;
import mspbots.data.tl.prod.contactscience.service.ContactscienceAppointmentsService;
import mspbots.data.tl.prod.contactscience.service.ContactscienceCallblockService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Log4j2
@Service
@Component
@RequiredArgsConstructor
public class ContactscienceSyncListenner {

    private final ContactscienceCallblockService contactscienceCallblockService;
    private final ContactscienceAppointmentsService contactscienceAppointmentsService;

    @RabbitListener(queues = "contactscience.callblock.tl")
    public void syncContactscienceCallblock(ResultMessageModel model) {
        contactscienceCallblockService.sync(model);
    }

    @RabbitListener(queues = "contactscience.appointments.tl")
    public void syncContactscienceAppointments(ResultMessageModel model) {
        contactscienceAppointmentsService.sync(model);
    }
}
